//
//  Glob.h
//  Calendar
//
//  Created by glave on 13-11-26.
//
//

#import <Foundation/Foundation.h>
#import "Reachability.h"
#import "JSONKit.h"
//#import "AKTabBarController.h"
#import "AppDelegate.h"
#define SLIDE_IMG_WIDTH DEFAULT_thumbImageWidth
#define SLIDE_IMG_HEIGHT DEFAULT_thumbImageHeight

#define NAVBAR_HEIGHT 44.0f
#define TABBAR_HEIGHT 49.0f
#define STATUS_HEIGHT 20.0f

#define TOP_VIEW_HEIGHT 33.0f
#define TOP_VIEW_WIDTH 48.0f
#define kCELLPADDING 8
#define kStandardBarHeight 44

#define ARRSIZE(a)      (sizeof(a) / sizeof(a[0]))
//
#define IOS7   ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
#define IMAGEPATH @"http://demo.glavesoft.com/"
#define SERVICE_IP @"http://demo.glavesoft.com"
#define SERVICE_FILE @"/CarService.asmx"
//#define IMAGEPATH @"http://192.168.2.61/TelsaService/"
//#define SERVICE_IP @"http://192.168.2.61"
//#define SERVICE_FILE @"/TelsaService/CarService.asmx"
#define DEFAULT_CODE @"0AB0F29B-B1AB-6A0A-6FFF-88618606D1A0"
#define PUSH_HOME @"http://push.glavesoft.com/push_information/"
#define TOKEN_UPLOAD_URL(token,companyId) [NSString stringWithFormat:@"%@htdocs/index.php?c=index&a=registerphone&deviceid=%@&companyid=%@&phonetype=1", PUSH_HOME, token, companyId]
//推送注册接口
#define RegisterPushService(uid,companyid,deviceid) [NSString stringWithFormat:@"http://push.glavesoft.com/push_oa/index.php?c=mobile_api&a=deviceregistration&oa_uid=%@&companyid=%@&deviceid=%@&phonetype=1",uid,companyid,deviceid]

//OA客户端推送断开接口
#define StopPushService(companyid,deviceid) [NSString stringWithFormat:@"http://push.glavesoft.com/push_oa/index.php?c=mobile_api&a=pushbreak&companyid=%@&deviceid=%@&phonetype=1",companyid,deviceid]
#define PUSH_SERVICE_URL(companyid,tuisongcontent,tuisongurl,checkedvalue) [NSString stringWithFormat:@"http://push.glavesoft.com/push_oa/index.php?c=mobile_api&a=tuisong&company_id=%@&tuisongcontent=%@&tuisongurl=%@&checkedvalue=%@",companyid,tuisongcontent,tuisongurl,checkedvalue]

#define IMAGE_UPDATE_URL(companyUrl) [NSString stringWithFormat:@"%@phone_imageupload.php",companyUrl]
//登录后个人详细资料
#define Contacts_person_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_user.php",companyUrl]

//登录后修改个人详细资料
#define person_EDIT_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_user.php?action=save",companyUrl]

//与某个同事的私信列表
#define SIXIN_DETAIL_URL(companyUrl,uid,page) [NSString stringWithFormat:@"%@phonetestapi/phone_message.php?action=info&uid=%@&perpage=%d&page=%d",companyUrl,uid,20,page]

//发私信
#define SIXIN_SEND_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_sendmessage.php",companyUrl]

#define QUIT_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_login.php?action=logout",companyUrl]

//公告栏列表
#define noticeBoard_LIST(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_news.php?action=list",companyUrl]
//公告栏详细页面
#define noticeBoard_LIST_DETAIL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_news.php?action=views",companyUrl]
//公告栏搜索
#define noticeBoard_LIST_SEARCH(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_news.php?action=search",companyUrl]

//企业墙列表
#define EnterpriseWall_LIST(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_groupchat.php?action=forumlist",companyUrl]
//企业墙帖子列表
#define EnterpriseWall_LIST_SHOW(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_groupchat.php?action=threadlist&perpage=20",companyUrl]
////帖子具体列表
//#define Enterprise_Depart_SHOW [NSString stringWithFormat:@"%@phonetestapi/phone_groupchat.php?action=view&perpage=20&tid=7"]
//帖子发布
#define Enterprise_ADD(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_groupchat.php?action=add",companyUrl]
//帖子回复--评论
#define Enterprise_Comment(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_groupchat.php?action=reply",companyUrl]



//我的工作台私信提示
#define MYWorkShow_REMINDER(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_message.php?action=total",companyUrl]
//工作台的我要做的事 消息 （名字+条数）
#define MYWorkShow_WORKSPACE(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_workspace_test.php?action=part",companyUrl]

//我的工作台删除某个人私信提示
#define MYWorkShow_DeleteSixin(companyUrl,userId) [NSString stringWithFormat:@"%@phonetestapi/phone_message.php?action=delete&id=%@",companyUrl,userId]
//待办--个人任务统计
#define Schedule_PERSONAL_NUM(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_duty.php?action=statistics",companyUrl]

//日志--个人任务统计
#define LOG_PERSONAL_NUM(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_record.php?action=statistics",companyUrl]

//电话号码
#define REGTEL [NSString stringWithFormat:@"0\\d{2,3}-\\d{7,8}"]
//邮箱
#define REGEMAIL [NSString stringWithFormat:@"^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"]
//QQ号（只能输入数字）
#define REGQQ [NSString stringWithFormat:@"^[0-9]*$"]
////邮编（只能输入六个数字）
#define REGEMS [NSString stringWithFormat:@"^[0-9]{6}"]

#define SHOW_TAB_FRAME [Glob currentResolution] == UIDevice_iPhoneTallerHiRes?CGRectMake(0,33,320,472):CGRectMake(0,33,320,385)
#define HIDE_TAB_FRAME  [Glob currentResolution] == UIDevice_iPhoneTallerHiRes?CGRectMake(0,0,320,460):CGRectMake(0,0,320,372)
#define LINE_COLOR RGBCOLOR(204, 204, 204)
#define RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; }
//////////////////////////////////////
//广发银行url
//登录url
#define LOGIN_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_login.php?action=login",companyUrl]
//企业内部通讯录
#define DEPARTMENTLIST_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_departmentlist.php",companyUrl]
//部门内联系人
#define Contacts_depid_URL(companyUrl,deptid,page) [NSString stringWithFormat:@"%@phonetestapi/phone_employeelist.php?departmentid=%@&perpage=%d&page=%d",companyUrl, deptid, 20, page]
//个人客户通讯录列表
#define CLENT_CONTACTS_URL(companyUrl,page) [NSString stringWithFormat:@"%@phonetestapi/phone_customlist.php?perpage=%d&page=%d",companyUrl, 20, page]
//添加客户通讯录
#define CUSTOMERLIST_ADD_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_customlist.php?action=add",companyUrl]
//修改某个员工的客户通讯录
#define CUSTOMERLIST_EDIT_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_customlist.php?action=edit",companyUrl]
//删除某个员工的客户通讯录
#define CUSTOMERLIST_DELETE_URL(companyUrl,uid) [NSString stringWithFormat:@"%@phonetestapi/phone_customlist.php?action=delete&id=%@",companyUrl,uid]

//首发私信
#define SIXIN_SEND_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_sendmessage.php",companyUrl]

//上传图片
#define IMAGE_UPDATE_URL(companyUrl) [NSString stringWithFormat:@"%@phone_imageupload.php",companyUrl]
//广发银行通讯录正则表达式
//手机号
#define REGPHONE [NSString stringWithFormat:@"^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"]
/*
 ios6
 #define REGPASS [NSString stringWithFormat:@"[\\da-zA-Z]+[a-zA-Z]+[\\da-zA-Z]{4,17}$"]
 */
//密码
#define REGPASS [NSString stringWithFormat:@"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$"]
//电话号码
#define REGTEL [NSString stringWithFormat:@"0\\d{2,3}-\\d{7,8}"]
//邮箱
#define REGEMAIL [NSString stringWithFormat:@"^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"]
//QQ号（只能输入数字）
#define REGQQ [NSString stringWithFormat:@"^[0-9]*$"]
////邮编（只能输入六个数字）
#define REGEMS [NSString stringWithFormat:@"^[0-9]{6}"]

//审批流程类型
#define SHENPI_LIUCHRNGTYPE_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=typelist",companyUrl]
//审批 总表
#define SHENPI_GLOBAL_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=list",companyUrl]
//审批 分表
#define SHENPI_LIST_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=glist",companyUrl]
//审批 请求
#define SHENPI_UPDATE_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=update",companyUrl]
//申请审批 新增
#define SHENPI_ADD_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=add",companyUrl]
//审批详细
#define SHENPI_DETAIL_URL(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_approve.php?action=view",companyUrl]
//签到
#define QIANDAO_URL(companyUrl)   [NSString stringWithFormat:@"%@phonetestapi/phone_usercheck.php",companyUrl]
//签到历史轨迹
#define QIANDAO_HISTORY_URL(companyUrl,date)   [NSString stringWithFormat:@"%@phonetestapi/phone_usercheckhistory.php?date=%@",companyUrl,date]
//考试
#define KAOSHI_LIST_URL   [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/list.php"]

#define KAOSHI_LIST_INFO_URL  [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/test_start.php"]

#define KAOSHI_TEST_URL(id)  [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/test.php?testid=%d",id]
#define KAOSHI_FINISH_URL  [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/end.php"]
#define KAOSHI_VIEW_SCORE_URL(id)  [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/view.php?testid=%d",id]
#define KAOSHI_VIEW_DONE_URL(id)   [NSString stringWithFormat:@"http://push.glavesoft.com/tcexam/public/code/detailed.php?testid=%d",id]

//日志排行榜
#define Log_SORT(companyUrl)  [NSString stringWithFormat:@"%@phonetestapi/phone_record.php?action=statistics",companyUrl]

//
//日程管理--某月有哪几天有未读消息
#define ScheduleManager_WhatDayInMonth(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_Schedule.php?action=total",companyUrl]
//日程管理--某一天有哪几条未读信息
#define ScheduleManager_DayHaveWhat(companyUrl) [NSString stringWithFormat:@"%@phonetestapi/phone_Schedule.php",companyUrl]

//广发银行私信
#define kMESSAGE_TYPE @"messageType"
#define kMESSAGE_FROM @"messageFrom"
#define kMESSAGE_TO @"messageTo"
#define kMESSAGE_CONTENT @"messageContent"
#define kMESSAGE_DATE @"messageDate"
#define kMESSAGE_ID @"messageId"

enum kWCMessageType {
    kWCMessageTypePlain = 0,
    kWCMessageTypeImage = 1,
    kWCMessageTypeVoice =2,
    kWCMessageTypeLocation=3
};

enum kWCMessageCellStyle {
    kWCMessageCellStyleMe = 0,
    kWCMessageCellStyleOther = 1,
    kWCMessageCellStyleMeWithImage=2,
    kWCMessageCellStyleOtherWithImage=3
};

enum {
    // iPhone 1,3,3GS 标准分辨率(320x480px)
    UIDevice_iPhoneStandardRes      = 1,
    // iPhone 4,4S 高清分辨率(640x960px)
    UIDevice_iPhoneHiRes            = 2,
    // iPhone 5 高清分辨率(640x1136px)
    UIDevice_iPhoneTallerHiRes      = 3,
    // iPad 1,2 标准分辨率(1024x768px)
    UIDevice_iPadStandardRes        = 4,
    // iPad 3 High Resolution(2048x1536px)
    UIDevice_iPadHiRes              = 5
}; typedef NSUInteger UIDeviceResolution;

typedef enum {
    ShenPiContactType_Single = 0,
    ShenPiContactType_Double
}ShenPiContactType;

typedef enum {
    ShenPiApplyType_Approve,
    ShenPiApplyType_Apply
}ShenPiApplyType;
typedef enum {
    ShiJuanType_undo,
    ShiJuanType_do
}ShiJuanType;
@interface Glob : NSObject

+(UIBarButtonItem *)getNavigationBarBackButton:(UIViewController *)target imgName:(NSString *)name;
+(UIBarButtonItem *)getNavigationBarSetButton:(UIViewController *)target imgName:(NSString *)name;
+(NSString *)stringFromDate:(NSDate *)date;
+(NSDate *)dateFromString:(NSString *)string;

+(CGMutablePathRef)pathwithFrame:(CGRect)frame withRadius:(float)radius;


//设置域名
+ (void) setCompanyUrl:(NSString*)urlString;
//获取域名
+ (NSString*) getCompanyUrl;

+ (void) setUserInfo:(id)info;
+ (id) getUserInfo;
+ (void)loadLastUserAccount;
+ (void)clearLastUserAccount;


+ (void) setShowAuthorByDefault:(BOOL)value;
+ (BOOL) isShowAuthorByDefault;

//+ (void) setShowImageByDefault:(BOOL)value;
//+ (BOOL) isShowImageByDefault;
//
//+ (void) setNotShowImageByWWAN:(BOOL)value;
//+ (BOOL) isNotShowImageByWWAN;
//+ (BOOL) isWWAN;
//+ (void) saveUserInfo:(id)userInfo;
//- (void) spyNetwork;

+ (UIBarButtonItem*)getLoginButton;
+ (UIBarButtonItem*)getDisclosureButton;
+ (UIBarButtonItem*)getPostButton;
+ (UIBarButtonItem*)getReplyButton;
+ (UIBarButtonItem*)getAddCustButton;
+ (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;



+ (UIDeviceResolution) currentResolution;

+(long)changeTimeToTimeSp:(NSString *)timeStr;
+(long)getTimeSp;
+(void)showTabBar;
+(void)hideTabBar;

+ (void)showHUD:(NSString *)msg;
+ (void)removeHUD;
@property (nonatomic, strong) Reachability* reachability;



@end
